﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Bonehead
{
    public partial class ProgressDialog : Form
    {
        private long mLength = 0;
        private long mPosition = 0;

        public ProgressDialog()
        {
            InitializeComponent();
        }

        public void SetLength(long aLength)
        {
            mPosition = 0;
            mLength = aLength;
            mProgressBar.Maximum = 0;
            mProgressBar.Maximum = 100;
            mProgressBar.Value = 0;
        }

        public void Update(long aPos)
        {
            long pos = (aPos * 100) / mLength;
            if (pos != mPosition)
            {
                mPosition = pos;
                mProgressBar.Value = (int)pos;
                Application.DoEvents();
            }
        }
    }
}
